<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of project
 *
 * @author truongkx
 */
class project extends CP_Controller{
    //put your code here
    function __construct() {
        parent::__construct('project','','Id');
    }
    protected function beforecommit(){
        if(isset($_REQUEST['Params']['Content']))$_POST['Params']['Content'] = $_REQUEST['Params']['Content'];
		if(isset($_REQUEST['Params']['Content2']))$_POST['Params']['Content2'] = $_REQUEST['Params']['Content2'];
    } 
    
    public function binding(){
		$this->backend_model->datatables_config=array(
				"table"=>"project",
				"select"=>"
					SELECT SQL_CALC_FOUND_ROWS
						Id,
						Title,
						Alias,
						Thumb,
						`Desc`,
						Position,
						Tag,
						`Insert`,
						`Update`,
						Status
					FROM project",
				"where"     =>"Where true",
				"order_by"=>"Order By `Insert` DESC  ",
				"columnmaps"=>array(
						
				)
		);
        $R=$this->backend_model->_bindingdata();
        $this->output->set_header('Content-type: application/json');
        $this->output->set_output(json_encode($R));
    }
    function index(){
        echo $c=$this->load->view('cms/cp/03_project/viewport',$this->assigns,true);
    }
    
    function editpanel(){
        $Id=(int)$this->input->post('Id');
        if($Id>0){
            $this->assigns->item=$this->backend_model->onGet($Id);
        }
        $c=$this->load->view('cms/cp/03_project/editpanel',$this->assigns,true);
        $R["result"] = 1;
        $R["message"]='SUCCESS !';
        $R["htmlreponse"]=$c;
        $this->output->set_header('Content-type: application/json');
        $this->output->set_output(json_encode($R));
    }
}

?>
